#ifndef YCCONTROLSLOADINGFRAME_H
#define YCCONTROLSLOADINGFRAME_H
#include <QLabel>

QT_BEGIN_NAMESPACE
class QTimer;
QT_END_NAMESPACE

namespace yc {

class LoadingFrame : public QFrame
{
    Q_OBJECT

public:
    explicit LoadingFrame(const QString& text, QWidget* parent = nullptr);
    LoadingFrame(const QString& text, const QSize& icon_size, const QString& path, int count,
                 int index_width = 0, int interval = 50, QWidget* parent = nullptr);

    void setText(const QString& text);
    void setPath(const QSize& icon_size, const QString& path, int count = 0, int index_width = 0,
                 int interval = 50);

protected:
    void showEvent(QShowEvent* e) override;
    void hideEvent(QHideEvent* e) override;

private:
    void changeImage();

    QString path_;
    int count_;
    int index_width_;
    QLabel* image_;
    QLabel* text_;
    int index_;
    QTimer* timer_;
};

} // namespace ocsb

#endif // YCCONTROLSLOADINGFRAME_H
